package com.virtualperson.controller;

import com.virtualperson.dto.ImageGenerationRequest;
import com.virtualperson.dto.ImageGenerationResponse;
import com.virtualperson.service.ImageGenerationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/image")
public class ImageController {

    @Autowired
    private ImageGenerationService imageGenerationService;

    @PostMapping("/generate")
    public ImageGenerationResponse generateImage(@RequestBody ImageGenerationRequest request) {
        log.info("收到图片生成请求: {}", request);
        return imageGenerationService.generateImage(request);
    }

    @GetMapping("/task/{taskId}")
    public ImageGenerationResponse getTaskStatus(@PathVariable String taskId) {
        log.info("查询任务状态: {}", taskId);
        return imageGenerationService.getTaskStatus(taskId);
    }
} 